home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Gobby 0.4.7 / gobby-0.4.7.exe / {app} / share / gtksourceview-2.0 / language-specs / def.lang < prev    next >
Extensible Markup Language  |  2008-09-09  |  10KB  |  269 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.  Authors: Marco Barisione, Emanuele Aina
  5.  Copyright (C) 2005-2007 Marco Barisione <barisione@gmail.com>
  6.  Copyright (C) 2005-2007 Emanuele Aina
  7.  
  8.  This library is free software; you can redistribute it and/or
  9.  modify it under the terms of the GNU Library General Public
  10.  License as published by the Free Software Foundation; either
  11.  version 2 of the License, or (at your option) any later version.
  12.  
  13.  This library is distributed in the hope that it will be useful,
  14.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  Library General Public License for more details.
  17.  
  18.  You should have received a copy of the GNU Library General Public
  19.  License along with this library; if not, write to the
  20.  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21.  Boston, MA 02111-1307, USA.
  22.  
  23. -->
  24. <language id="def" _name="Defaults" hidden="true" version="2.0">
  25.     <styles>
  26.  
  27.         <!-- styles defined here are all the styles that
  28.              a language can use as default for its styles.
  29.              The styles are defined in logical groups.
  30.              A style scheme has to at least define the style
  31.              for the first item of each group and if desired
  32.              define the style for the other items to achieve a
  33.              more finegrained control on the apperance.
  34.              Finally a style scheme may also define language
  35.              specific styles. -->
  36.  
  37.  
  38.         <!-- Comment group -->
  39.  
  40.         <!-- Any comment -->
  41.         <style id="comment" _name="Comment"/>
  42.  
  43.         <!-- A shebang: #!/bin/sh -->
  44.         <style id="shebang" _name="Shebang" map-to="def:comment"/>
  45.  
  46.         <!-- A special comment containing documentation like in javadoc or
  47.              gtk-doc -->
  48.         <style id="doc-comment" _name="Documentation comment" map-to="def:comment"/>
  49.  
  50.         <!-- A element inside a documentation comment: @author -->
  51.         <!-- This style doesn't map to anything since it must be used as an additional
  52.              style for text which is already styled as a "doc-comment" -->
  53.         <style id="doc-comment-element" _name="Documentation comment element" />
  54.  
  55.  
  56.         <!-- Constant group -->
  57.  
  58.         <!-- Any constant -->
  59.         <style id="constant" _name="Constant"/>
  60.  
  61.         <!-- A character constant: 'c' -->
  62.         <style id="character" _name="Character" map-to="def:constant"/>
  63.  
  64.         <!-- A string constant: "this is a string" -->
  65.         <style id="string" _name="String" map-to="def:constant"/>
  66.  
  67.         <!-- Special character in a string constant: "%s", "\t" -->
  68.         <!-- This style doesn't map to anything since it must be used as an additional
  69.              style for text which is already styled as a "string" -->
  70.         <style id="special-char" _name="Special character (inside a string)" />
  71.  
  72.         <!-- A generic number constant -->
  73.         <style id="number" _name="Number" map-to="def:constant"/>
  74.  
  75.         <!-- A floating point constant: 2.3e10 -->
  76.         <style id="floating-point" _name="Floating point number" map-to="def:number"/>
  77.  
  78.         <!-- A decimal number: 1234 -->
  79.         <style id="decimal" _name="Decimal number" map-to="def:number"/>
  80.  
  81.         <!-- A base-N number: 0xFFFF -->
  82.         <style id="base-n-integer" _name="Base-N number" map-to="def:number"/>
  83.  
  84.         <!-- A complex number -->
  85.         <style id="complex" _name="Complex number" map-to="def:number"/>
  86.  
  87.         <!-- A special constant like NULL in C or null in Java -->
  88.         <style id="special-constant" _name="Special constant" map-to="def:constant"/>
  89.  
  90.         <!-- A boolean constant: TRUE, false -->
  91.         <style id="boolean" _name="Boolean value" map-to="def:special-constant"/>
  92.  
  93.  
  94.         <!-- Identifier group -->
  95.  
  96.         <!-- Any variable name -->
  97.         <style id="identifier" _name="Identifier" />
  98.  
  99.         <!-- A function name (also: methods for classes) -->
  100.         <style id="function" _name="Function" map-to="def:identifier"/>
  101.  
  102.         <!-- A builtin name: like __import__, abs in Python
  103.             (see http://docs.python.org/lib/built-in-funcs.html) -->
  104.         <style id="builtin" _name="Built-in identifier" map-to="def:identifier"/>
  105.  
  106.  
  107.         <!-- Statement group -->
  108.  
  109.         <!-- Any statement -->
  110.         <style id="statement" _name="Statement"/>
  111.  
  112.         <!-- Operators: "+", "*", etc. -->
  113.         <style id="operator" _name="Operator" map-to="def:statement" />
  114.  
  115.         <!-- keywords: "if", "for", "while", etc. -->
  116.         <style id="keyword" _name="Keyword" map-to="def:statement" />
  117.  
  118.  
  119.         <!-- Type group -->
  120.  
  121.         <!--A primitive data type: int, long, char, etc. -->
  122.         <style id="type" _name="Data type"/>
  123.  
  124.  
  125.         <!-- Others -->
  126.  
  127.         <!-- This one is for '#include <foo.h>' and "#pragma blah", or 'use foobar', etc.. -->
  128.         <style id="preprocessor" _name="Preprocessor directive"/>
  129.  
  130.         <!-- Any erroneous construct -->
  131.         <style id="error" _name="Error"/>
  132.  
  133.         <!--Reserved keywords: like "const" and "goto" in Java -->
  134.         <style id="reserved" _name="Reserved keyword" map-to="def:error" />
  135.  
  136.         <!-- Anything that needs extra attention; mostly the keywords TODO, FIXME and XXX -->
  137.         <style id="note" _name="Note (FIXME, TODO, XXX, etc.)"/>
  138.  
  139.         <!-- Text that stands out, HTML links, e-mail addresses, etc. -->
  140.         <style id="underlined"          _name="Underlined"/>
  141.  
  142.     </styles>
  143.  
  144.     <definitions>
  145.  
  146.         <!-- An empty string always matches. -->
  147.         <define-regex id="always-match"></define-regex>
  148.  
  149.         <!-- $^ never matches. -->
  150.         <define-regex id="never-match">$^</define-regex>
  151.  
  152.         <define-regex id="decimal" extended="true">
  153.             (?<![\w\.]) ([1-9][0-9]* | 0) (?![\w\.])
  154.         </define-regex>
  155.         <define-regex id="octal" extended="true">
  156.             (?<![\w\.]) 0 [0-7]+ (?![\w\.])
  157.         </define-regex>
  158.         <define-regex id="hexadecimal" extended="true">
  159.             (?<![\w\.]) 0 [xX] [0-9a-fA-F]+ (?![\w\.])
  160.         </define-regex>
  161.         <define-regex id="float" extended="true" case-sensitive="false">
  162.                 \b
  163.                 ([0-9]+ e [-+]? [0-9]+ |
  164.                  ([0-9]* \. [0-9]+ | [0-9]+ \.)
  165.                  (e [-+]? [0-9]+)?) [fl]?
  166.                 \b
  167.         </define-regex>
  168.  
  169.         <context id="decimal" style-ref="decimal">
  170.             <match>\%{decimal}</match>
  171.         </context>
  172.         <context id="octal" style-ref="base-n-integer">
  173.             <match>\%{octal}</match>
  174.         </context>
  175.         <context id="hexadecimal" style-ref="base-n-integer">
  176.             <match>\%{hexadecimal}</match>
  177.         </context>
  178.         <context id="float" style-ref="floating-point">
  179.             <match>\%{float}</match>
  180.         </context>
  181.  
  182.         <!-- FIXME no \n in patterns! -->
  183.         <define-regex id="net-address" extended="true" case-sensitive="false">
  184.                 \%[                                         # separator
  185.                 (https?|ftp|nntp|news|javascript|about):    # protocol
  186.                 [^\ \n]* [^\ \n.:;,?><)]              # address
  187.                 (?![a-z0-9_.-])                             # separator
  188.         </define-regex>
  189.  
  190.         <define-regex id="email-address" extended="true" case-sensitive="false">
  191.                 \%[                 # separator
  192.                 (mailto:)?          # optional "mailto:"
  193.                 [a-z0-9_.+-]+       # user name
  194.                 @                   # at
  195.                 [a-z0-9_.+-]+       # domain
  196.                 \%]                 # separator
  197.         </define-regex>
  198.  
  199.         <context id="in-comment">
  200.             <include>
  201.                 <context id="net-address" extend-parent="false" style-ref="underlined">
  202.                     <match>\%{net-address}</match>
  203.                 </context>
  204.                 <context id="email-address" extend-parent="false" style-ref="underlined">
  205.                     <match>\%{email-address}</match>
  206.                 </context>
  207.                 <context id="comment-note" extend-parent="false" style-ref="note">
  208.                     <match>\b(FIXME|TODO|XXX)\b</match>
  209.                 </context>
  210.             </include>
  211.         </context>
  212.  
  213.         <!-- A line comment starting with # -->
  214.         <context id="shell-like-comment" style-ref="comment" end-at-line-end="true">
  215.           <start>#</start>
  216.           <include>
  217.             <context ref="in-comment"/>
  218.           </include>
  219.         </context>
  220.  
  221.         <context id="line-continue" style-ref="preprocessor">
  222.             <start>\\$</start>
  223.             <end>^</end>
  224.         </context>
  225.  
  226.         <!-- this is intended to be used from line comments
  227.              that can continue on a different line after "\" -->
  228.         <context id="in-line-comment">
  229.           <include>
  230.             <context ref="line-continue" ignore-style="true"/>
  231.             <context ref="in-comment"/>
  232.           </include>
  233.         </context>
  234.  
  235.         <context id="shebang" style-ref="shebang" first-line-only="true">
  236.             <start>^#!</start>
  237.             <end>$</end>
  238.         </context>
  239.  
  240.         <context id="escape" style-ref="special-char">
  241.             <match>\\.</match>
  242.         </context>
  243.  
  244.         <!-- usual quoted string, ends at line end, \ is an escape char -->
  245.         <context id="string" style-ref="string" end-at-line-end="true">
  246.             <start>"</start>
  247.             <end>"</end>
  248.             <include>
  249.                 <context ref="escape"/>
  250.                 <context ref="line-continue"/>
  251.             </include>
  252.         </context>
  253.  
  254.         <!-- same thing but with single quote marks -->
  255.         <context id="single-quoted-string" style-ref="string" end-at-line-end="true">
  256.             <start>'</start>
  257.             <end>'</end>
  258.             <include>
  259.                 <context ref="escape"/>
  260.                 <context ref="line-continue"/>
  261.             </include>
  262.         </context>
  263.  
  264.         <!-- Dummy context, needed to load the style mappings when parsing v1 files -->
  265.         <context id="def"/>
  266.  
  267.     </definitions>
  268. </language>
  269.